package com.wgy.designmode.action.command.invoker;

import com.wgy.designmode.action.command.commond.Commond;

import java.util.ArrayList;
import java.util.List;

/**
 * 将军
 */
public class General {

    private List<Commond> commonds;

    public General() {
        commonds = new ArrayList<>();
    }

    public void takeCommond(Commond commond){
        commonds.add(commond);
    }

    public void executeCommond(){
        for (Commond commond : commonds) {
            commond.execute();
        }
        commonds.clear();
    }
}
